def-expression defines legato, humanize and velocity expressions for instruments. The definition of a default instrument is used for all compiled instruments, unless a specific instrument is defined. If the default definition is missing, no special processing takes place.
The def-description begins with the instrument name, followed by a list of parameter descriptions. The parameters are (legato..), which controls the note length, (humanize..), which controls the note starting point, and (velocity..), which controls the note velocity. The parameter descriptions and the whole parameter description block are enclosed in parenthesis. The description order is free.
Making Human-like Errors
Because you define note-lengths and rhythms as exact durations the MIDI file output is bound to lack the 'natural' quality achieved by conventional unquantised MIDI recording. def-expression lets you add different and controllable degrees of articulation, note attack position and velocity to MIDI scores that are to be realised in performance by synthesisers and samplers.
However, this may not be appropriate if your compiled MIDI files are to be read by a scorewriter to create staff notated scores for human performance, or you work in some styles of electro-pop. Furthermore, adding articulation parameters with def-expression may extend compilation time considerably on some Macintoshes.
All parameters are controlled by brownian noise. This is used in fractal modelling techniques to construct natural forms like mountains, clouds and rivers. Each parameter follows its own brownian noise waveform. Hence, if there are 10 instruments in the song and each of them uses legato, humanize and velocity expressions, then 30 independent brownian waveforms are controlling the surface level of the music, adding warmth, softness and naturalness to it. You can also use any vector pattern to control the humanizer. This is done by replacing the smoothness parameter with standard function call, like the (legato 70 6 (gen-sin 1 1 256)) as in the previous example. This passes over the internal brownian randomizer and the output of gen-sin now controls the humanizer process varying the reciprocal value 70 percent in the range from -20 to +20 percent.
Parameters
humanize minimum maximum smoothness &optional vector-pattern
humanize humanizer controls the note attack position. (humanize 0 2 0.2) modifies the attack position by tick values of 0, 1 or 2 using the brownian noise to determine the actual value. Be careful with the values, since -3 3 produce a musician that sounds quite untalented or even drunk. The smoothness values range from 0.0001 to 0.9999. The minimum value makes a curve that resembles a distant horizon and the maximum value creates very rough mountain silhouette. The best results are often somewhere in between. If the optional vector-pattern is supplied then it replaces the brownian noise. This way you can use any data to control the humanizer values.
velocity
+-velocity smoothness &optional vector-pattern
This adjusts the velocity values using brownian noise to determine the amount of velocity change. (velocity 10 0.3) alters the velocities by adding or subtracting values between -10.. 10. The smoothness is controlled by the smoothness parameter. If the optional vector-pattern is supplied then it replaces the brownian noise. This way you can use any data to control the velocity values.
legato controls individual note lengths. Length gives the initial value for the note length. If it is 70, then the actual note length is 70 percent of the value generated by the compiler. Variation controls how much the length varies in percents, and smoothness controls the brownian noise smoothness. (legato 70 10 0.1) generates a note which length is 70 +-10 percent (60-80 percent) of the note generated by the compiler. In other words, if the compiler generates a wholenote, then the actual note length is 60-80 percent of it, and if the note is 1/16, the value will become 60-80 percent of the original. If the optional vector-pattern is supplied then it replaces the brownian noise. This way you can use any data to control legato values.);;